﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Common.Base.Test
{
    public abstract class TestBase : ITest
    {
        protected abstract string Title { get; }
        public void RunTest()
        {
            try
            {
                Console.WriteLine(string.Format(">>>>>  Start:{0}===============================================", this.GetType()));
                Console.WriteLine(string.Format("=====  "));
                Console.WriteLine(string.Format("Title：{0}", this.Title));
                Console.WriteLine(string.Format("=====  "));
                Console.WriteLine();
                OnRunTest();
                Console.WriteLine();
                Console.WriteLine(string.Format("<<<<<  End:{0}=================================================", this.GetType()));
            }
            catch (Exception x)
            {
                Console.WriteLine(string.Format("Message: {0}\r\nDetails: {1}", x.Message, x.StackTrace));
            }
            finally
            {
                Console.WriteLine();
                Console.WriteLine("->>>>  键入任意值继续执行！");
                Console.WriteLine();
                Console.ReadKey();
            }
        }

        public abstract void OnRunTest();
    }
}
